<?php
namespace app\common\request;

class Server extends Base {
	public function message2() {
		$signature = $this->get('signature');
		$echostr = $this->get('echostr');
		$timestamp = $this->get('timestamp');
		$nonce = $this->get('nonce');
		$openid = $this->get('openid');
		$encrypt_type = $this->get('encrypt_type');
		$msg_signature = $this->get('msg_signature');

 		$data = $this->getContent();
 		$token = $this->get_token();
		return compact('signature', 'echostr', 'timestamp', 'nonce', 'openid', 'encrypt_type', 'msg_signature', 'data', 'token');
	}

	public function get_token() {
		$config = config('wechat.other');
		if(!isset($config['miniprogram2'])) {
			return '';
		}
		$config = $config['miniprogram2'];
        if(!isset($config['token'])) {
            return '';
        }
        return $config['token'];
	}
}
